package io.github.weiranyi.config;

import org.springframework.cloud.client.loadbalancer.LoadBalanced;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.client.RestTemplate;

// 写一个配置类
@Configuration
public class ApplicationContextConfig {
    // 通过该方法向容器注入RestTemplate
    @Bean
    @LoadBalanced //2.启用负载均衡
    public RestTemplate restTemplate(){
        return new RestTemplate();
    }
}
